<?php
class Rpx{
    public static function getAuth($token){
        $rpxApiKey = sfConfig::get('app_rpx_api_key');

        $post_data = array('token' => $token,
                           'apiKey' => $rpxApiKey,
                           'format' => 'json');

        $curl = curl_init();
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_URL, 'https://rpxnow.com/api/v2/auth_info');
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        $raw_json = curl_exec($curl);
        curl_close($curl);

        /* STEP 3: Parse the JSON auth_info response */
        $auth_info = json_decode($raw_json, true);
        
        return $auth_info;
    }
}